﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using Fusion;

namespace Fusion.Interface
{
	public class Label : Control
	{
		public string text;
		public SpriteFont font;
		public Color textColor;

		Vector2 offset;
		float fontScale;

		public Label( Vector2 center, Vector2 Size, string contents, bool border, VoidDelegate ClickEvent )
		{
			position = center;
			size = Size;

			text = contents;
			Clicked += ClickEvent;

			drawBorder = border;

			font = Engine.Fonts.Get( "Retro" );

			if( ClickEvent == null )
				textColor = Color.White;
			else
				textColor = new Color( 0.16f, 0.88f, 0.92f, 1.0f );

			fontScale = 1;// size.Y / font.MeasureString( "TEST" ).Y;
			offset.X += 8;

		}

		public override void Draw()
		{
			if( hidden == true )
				return;

			base.Draw();

			Engine.spriteBatch.DrawString( font, text, Position + offset, textColor, 0, new Vector2( 0, 0 ), fontScale * Scale, SpriteEffects.None, 0.5f );
		}
	}
}
